#include <stdio.h>
#include <string.h>

int shu[20];
int n;
int d[410];

int an[20];
int min;

void di(int pt)
{
	int i,j,tot;

	if ((pt-2+d[shu[pt-1]])>=min) return ;

	if (shu[pt-1]==n)
	{
		min=pt-1;
		for (i=1;i<=pt-1;i++) 
			an[i]=shu[i];
		return;
	}
	for (i=pt-1; i>=1; i--)
		for (j=pt-1; j>=1; j--)
		{
			tot=shu[i]+shu[j];
			if (tot>shu[pt-1] && tot<=n)				
			{				
				shu[pt]=tot;
				di(pt+1);				
			}
		}
	
}



main()
{	
	int i;
//	freopen("addition.in","r",stdin);
	while (1)
	{
		scanf("%d", &n);
		if (n==0) break;
		if (n==1) printf("1\n");
		else if (n==2) printf("1 2\n");
		else if (n==3) printf("1 2 3\n");
		else 
		{
			shu[1]=1;
			shu[2]=2;
			shu[3]=4;

			min=13;

			for (i=n*2;i>n;i--)
				d[i]=1;
			d[n]=1;
			for (i=n-1;i>=1;i--)
				d[i]=d[i+i]+1;

			di(4);
			for (i=1;i<min;i++)
				printf("%d ", an[i]);
			printf("%d\n", an[i]);
		}


	}
	
	return 0;
}





















